package com.itheima.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo1 {
    public static void main(String[] args) {
        //collection是接口只能创建其实现类的对象
        Collection<String> coll = new ArrayList<>();
        coll.add("aaa");
        coll.add("bbb");
        coll.add("ddd");
        coll.add("ccc");
        Iterator<String> it =  coll.iterator();

        while (it.hasNext()){
            System.out.println(it.next());
        }
     //lambda表达式
      coll.forEach( s ->
              System.out.println(s)

      );
        //增强for
        for (String s : coll) {
            System.out.println(s);

        }
    }
}
